package principle.dependecy.inversion;

public class SetterDependency {
    private PersonThree personThree = new PersonThree();
    private IReciver emailReciver = new Email();
    private IReciver wxReciver = new WX();

    public static void main(String[] args) {
        SetterDependency setterDependency = new SetterDependency();
        setterDependency.start();
    }

    private void start() {
        personThree.setReciver(emailReciver);
        personThree.recive();
        personThree.setReciver(wxReciver);
        personThree.recive();
    }
}

class PersonThree {

    private IReciver reciver;

    public void setReciver(IReciver reciver) {
        this.reciver = reciver;
    }

    public void recive() {
        this.reciver.recive();
    }
}
